package jjn.acwing.java_basic;

import java.util.Scanner;

/**
 * @author Jjn
 * @since 2023/8/19 09:38
 */
public class Acwing668 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int c = scanner.nextInt();
        int d = scanner.nextInt();
        int x = 60 * a + b;
        int y = 60 * c + d;
        int hours, minutes;
        if (x < y) {
            minutes = y - x;
        } else {
            minutes = y - x + 60 * 24;
        }
        hours = minutes / 60;
        minutes = minutes % 60;
        System.out.printf("O JOGO DUROU %d HORA(S) E %d MINUTO(S)\n", hours, minutes);
    }
}
